package com.headingdata.exercise;

public class Test1 {
    public static void main(String[] args) {
        //5-10旺季 头等舱9折 经济舱8.5折  11-4月淡季，头等舱7折，经济舱6.5折
        //算出机票价格
        double price = calculatePrice(2000,4,"经济舱");
        System.out.println(price);
    }
    public static double calculatePrice(double price,int month,String type){
        if(month >=5 && month <= 10){
            switch (type){
                case "头等舱":
                    price *= 0.9;break;
                case "经济舱":
                    price *= 8.5;break;

            }
        }else{
            switch (type){
                case "头等舱":
                    price *= 0.7;break;
                case "经济舱":
                    price *= 0.65;break;

            }
        }
        return price;
    }
}
